/**
 * Copyright(c) 2006-2008, FeyaSoft Inc.
 * ====================================================================
 * Licence
 * ====================================================================
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
 * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
 * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 
 * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package("feyaSoft.desktop");

/**
 * This class is used to define window item for the desktop
 * application.
 */
feyaSoft.desktop.Window = new Ext.app.App({
    init :function(){
        Ext.QuickTips.init();
    },

    getModules : function(){
        return [
                new feyaSoft.desktop.Projects(),
                new feyaSoft.desktop.Technology(),
                new feyaSoft.desktop.Feedback(),
                new Donation(),
                new AboutUs()
            ];
    },
    
    // config for the start menu
    getStartConfig : function(){
        return {
            title: 'FeyaSoft Inc.',
            iconCls: 'feya_icon',
            toolItems: []
        };
    }
});

// define about us window module
AboutUs = Ext.extend(Ext.app.Module, {
    id: 'aboutUs',
    init : function(){
        this.launcher = {
            text: 'About Us',
            iconCls:'group',
            handler : this.aboutUsWindow,
            scope: this
        }
    },

    aboutUsWindow : function(src){
        new feyaSoft.desktop.AboutUs.aboutUsWindow(this.app);
    } 
});

// define tutorial window
feyaSoft.desktop.Technology = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: 'Technology',
            iconCls:'technology',
            menu : {
                items:[{
                     text: 'Ajax - Extjs',
                     iconCls:'script',
                     menu : {
                        items:[{
                           text: 'Grid Form Dialog Demo',
                           iconCls:'demo', 
                           handler : this.listDemouserWindow,
                           scope: this       
                        },{
                           text: 'Browser Source Codes',
                           iconCls:'sourceCode', 
                           handler : this.sourceCodeWindow,
                           scope: this       
                        }]
                     }
                  }]
            }
        }
    },

    listDemouserWindow : function(src){
        new feyaSoft.demouser.ListDemouser(this.app, src);
    },
    
    sourceCodeWindow : function(src){
        new feyaSoft.source.ListSource(this.app, src);
    } 
});

// define for Production Information
feyaSoft.desktop.Projects = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: 'Product Information',
            iconCls:'project',
            menu : {
                items:[{
                     text: 'Child Care Management',
                     iconCls:'careConn_icon',
                     menu : {
                        items:[{
                           text: 'Description',
                           iconCls:'document', 
                           handler : this.careConnDescWindow,
                           scope: this       
                        },{
                           text: 'CareConn Demo',
                           iconCls:'demo', 
                           handler : this.careConnDemoWindow,
                           scope: this       
                        }]
                     }
                  },{
                     text: 'FeyaSoft Dynamic Web',
                     iconCls:'feya_icon',
                     menu : {
                        items:[{
                           text: 'Browser Source Codes',
                           iconCls:'sourceCode', 
                           handler : this.sourceCodeWindow,
                           scope: this       
                        },{
                           text: 'Design and Description',
                           iconCls:'editItem', 
                           handler : this.designAndDocWindow,
                           scope: this       
                        }]
                     }
                  }]
            }
        }
    },

    sourceCodeWindow : function(src){
        new feyaSoft.source.ListSource(this.app, src);
    },
    
    designAndDocWindow : function(src){
        new feyaSoft.source.DesignAndDoc(this.app, src);
    },
    
    careConnDescWindow : function(src){
        new feyaSoft.careConn.Description.descWindow(this.app, src);
    },
  
    careConnDemoWindow : function(src){
        window.open('http://demo.feyasoft.com/careConn','careConn','width=950,height=600');
    }   
});

// define feedback window module
feyaSoft.desktop.Feedback = Ext.extend(Ext.app.Module, {
    init : function(){
        this.launcher = {
            text: 'Feedback',
            iconCls:'feedback',
            handler : this.feedbackWindow,
            scope: this
        }
    },

    feedbackWindow : function(src){
        new feyaSoft.feedback.ListFeedback(this.app, src);
    } 
});

// define donation window module
Donation = Ext.extend(Ext.app.Module, {
    init : function(){
        id: 'donate',
        this.launcher = {
            text: 'ExtJS Tutor',
            iconCls:'donate',
            handler : this.donateWindow,
            scope: this
        }
    },

    donateWindow : function(src){
        feyaSoft.desktop.Donate.donateWindow(this.app, src);
    } 
});



